#!/usr/bin/env python3

"""
设计一个单例模式
"""

class Singleton(object):
    __instance = None

    def __new__(cls, name, age, *args):
        if not cls.__instance:
            cls.__instance = object.__new__(cls)
        return cls.__instance


if __name__ == "__main__":
    a = Singleton("m", 23)
    print(id(a))
    b = Singleton("n", 26)
    print(id(b))
    a.age = 25
    print(a.age, b.age)
